package com.tengju.bff.interfaces.manage.crm.user.vo;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;

@Getter
@Setter
@NoArgsConstructor
public class NicknameVO {

    private String nickname;

    private String mobile;

    public NicknameVO(String nickname, String mobile) {
        this.nickname = nickname;
        this.mobile = mobile;
    }

    public NicknameVO(String nickname) {
        this.nickname = nickname;
    }

    @Override
    @JsonValue
    public String toString() {
        if(StringUtils.isNotEmpty(nickname)) {
            return nickname;
        }
        if (StringUtils.isNotEmpty(mobile)) {
            return "用户" + mobile.substring(mobile.length()-4);
        }
       return "";
    }

}
